from flask import Flask, request, jsonify

app = Flask(__name__)

import os

UPLOAD_FOLDER = 'D:\\home\\test'  # 定义上传文件的目录
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER  # 将目录配置给Flask应用
@app.route('/exe', methods=['POST'])  # 定义接受文件上传的路由
def upload_file():

    print(request.form.get("fileType"))
    print(request.form.get("exeType"))
    file = request.files['file']  # 从请求中获取文件

    if 'file' not in request.files:  # 检查请求中是否有文件
        return 'No file part', 400  # 返回错误信息

    if file.filename == '':  # 检查文件名是否为空
        return 'No selected file', 400  # 返回错误信息

    file.save(os.path.join(app.config['UPLOAD_FOLDER'], file.filename))  # 保存文件

    return 'File uploaded successfully', 200  # 返回成功信息

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)  # 在0.0.0.0:5000上运行Flask应用程序（您可以根据需要更改端口）
